<?php
namespace app\index\validate;

use think\Validate;
class UserAddressValidator extends Validate
{
    protected $rule = [
        'provide'       => 'chs|length:1,10',
        'city'          => 'chs|length:1,10',
        'county'        => 'chs|length:1,10',
        'street'        => 'chs|length:0,10',
        'detail'        => 'chsAlphaNum|length:1,10',
        'name'          => 'chsAlpha',
        'sex'           => 'number|in:0,1',
        'phone'         => 'mobile'
    ];

    protected $message = [
        'provide.chs'           =>  '请输入正确的省份',
        'provide.length'        =>  '请输入正确的省份',
        'city.chs'              =>  '请输入正确的城市',
        'city.length'           =>  '请输入正确的城市',
        'county.chs'            =>  '请输入正确的区',
        'county.length'         =>  '请输入正确的区',
        'street.chs'         =>  '请输入正确的街道',
        'street.length'         =>  '请输入正确的街道',
        'detail.chs'            =>  '请输入正确的地址',
        'detail.length'         =>  '请输入正确的地址',
        'name.chsAlpha'         =>  '联系人只能填写中文或英文',
        'sex.number'            =>  '性別只能是男或女',
        'phone.mobile'          =>  '请输入正确的号码',
    ];
}